<?php

require_once "LExceptions.php";

/**
 * 
 *  LCore.php
 * 
 */
class LCore {

    /**
     * loader - loads a file and the class in it if its available.
     * 
     * @throws LMissingFileException if file is not found
     * @throws LFailToLoadClassException if class is unavailable
     * 
     * @param string $name Filename to include and to load the class
     */
    public function loader($name) {
        if (!file_exists($name . ".php")) {
            throw new LMissingFileException("Hiányzó fájl, nem sikerült meghívni az osztályt", $name);
            $ret = false;
        } elseif (!class_exists($name)) {
            throw new LFailToLoadClassException();
            $ret = false;
        } else {
            include $name;
            $ret = true;
        }

        return $ret;
    }

}
